<template>
  <div class="wrapper" v-if="swiperSlides.length">
    <swiper :options="swiperOption" class="swiper">
      <swiper-slide v-for="(slide, index) in swiperSlides" :key="index">
        <a :href="slide.linkUrl">
          <img :src="slide.picUrl" alt class="swiper-img" />
        </a>
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>
<script>
export default {
  name: 'Carrousel',
  props: {
    swiperSlides: {
      type: Array
    }
  },
  data () {
    return {
      swiperOption: {
        pagination: { el: '.swiper-pagination' },
        loop: true,
        observer: true,
        observeParents: true,
        autoplay: {
          delay: 1000,
          disableOnInteraction: false
        }
      }
    }
  },
  mounted () {},
  methods: {}
}
</script>
<style lang="scss" scoped>
@import "common/scss/variable.scss";
.swiper /deep/ .swiper-pagination-bullet{
  width: 0.15rem ;
  height: 0.15rem ;
  background: #ccc;
  &.swiper-pagination-bullet-active{
    background: $color-theme;
    width: 0.35rem;
    height: 0.15rem;
    border-radius: 0.07rem;
  }
}
.wrapper {
  height: 0;
  padding-bottom: 40%;
  margin-top: 0.42rem;
  overflow: hidden;
  margin-bottom: 0.42rem;
  a {
    text-decoration: none;
    display: inline-block;
    width: 100%;
    .swiper-img {
      width: 100%;
    }
  }
}
</style>
